package com.smartthinking.CICPNL.home.activity;
import java.util.Dictionary;
import java.util.List;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Environment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.androidquery.AQuery;
import com.smartthinking.CICPNL.R;


public class MensajesArrayAdapter extends BaseAdapter {
  private final Context context;
  private final List<Dictionary<String,String>> values;
  private final String server;
  Utilities util;

  public MensajesArrayAdapter(Context context, List<Dictionary<String,String>> values, String server) {
	    this.context = context;
	    this.values = values;
	    this.server = server;
	    util = new Utilities();
  }
  

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View rowView;
    Dictionary<String,String> dic = values.get(position);
    
    if(! (dic.get("Header") == null)){
    	rowView = inflater.inflate(R.layout.ui_section_header, parent, false);
        TextView titulo = (TextView) rowView.findViewById(R.id.tv_header);
        titulo.setText(dic.get("Header").toString());
    }else{
    	rowView = inflater.inflate(R.layout.mensajes_item, parent, false);
        TextView titulo = (TextView) rowView.findViewById(R.id.txt_eve_titulo);
        titulo.setText(dic.get("push_text").toString());
    }

    return rowView;
  }

@Override
public int getCount() {
	// TODO Auto-generated method stub
	return values.size();
}

@Override
public Object getItem(int arg0) {
	// TODO Auto-generated method stub
	return null;
}

@Override
public long getItemId(int arg0) {
	// TODO Auto-generated method stub
	return 0;
}
} 
